import React, { useState } from 'react'

export default function App() {
  const [person, setPerson] = useState([
    {
      id: "001",
      name: "zhang",
      age: 18
    }, {
      id: "002",
      name: "wang",
      age: 19
    }
  ])
  const [count, setCount] = useState(0)



  function addPerson() {
    setPerson([...person, { id:"003", name: "crry", age: "4" }])
  }


  return (
    <div>
      {
        person.map(item => {
          const { id, name, age } = item
          return <div key={id}>
            <li >{name}</li>
            <li>{age}</li>
          </div>
        })
      }
      <button onClick={addPerson}>点击添加人口</button>
    </div>

  )
}
